package com.gs.auth.controller;

import com.gs.auth.service.LoginService;
import com.gs.auth.vo.LoginVo;
import com.gs.common.core.domain.AjaxResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class LoginController {

    @Resource
    private LoginService loginService;

    @RequestMapping("/login")
    public AjaxResult login(@RequestBody LoginVo loginVo){
        String token =loginService.login(loginVo);
        return AjaxResult.success("登录成功",token);
    }

    @RequestMapping("/web/login")
    public AjaxResult webLogin(@RequestBody LoginVo loginVo){
        String token =loginService.webLogin(loginVo);
        return AjaxResult.success("登录成功",token);
    }


}
